Skip to content

security: harden ember-protocol input validation - #131

Merged
kacy merged 1 commit into
mainfrom
security/protocol-hardening
Feb 14, 2026
Merged

security: harden ember-protocol input validation#131
kacy merged 1 commit into
mainfrom
security/protocol-hardening

Conversation

@kacy

@kacy kacy commented Feb 14, 2026

Copy link
Copy Markdown
Owner

summary

  • parse_f64 now rejects inf/-inf in addition to NaN, making it consistent with parse_incrbyfloat which already had this check. prevents infinite scores in sorted sets.
  • parse_slot_list and parse_cluster_setslot now validate that slot numbers are in the valid 0-16383 range. previously, any u16 value was accepted.
  • parse_vadd/parse_vsim check MAX_VECTOR_DIMS inside the parsing loop instead of after full allocation, preventing unnecessary memory usage from oversized vectors.

what was tested

  • cargo test -p ember-protocol — all 319 tests pass
  • verified existing infinity-rejection test in parse_incrbyfloat still works
  • confirmed slot validation catches values >= 16384

design considerations

  • the infinity rejection in parse_f64 matches redis behavior (redis rejects inf as a ZADD score)
  • slot validation uses 16384 constant directly rather than importing from ember-cluster to avoid a circular dependency
  • vector dim check is now fail-fast: stops parsing immediately at the limit rather than allocating then checking

…tor parsing eagerly

- parse_f64 now rejects inf/-inf (was only rejecting NaN), making it
  consistent with parse_incrbyfloat which already had this check
- parse_slot_list and parse_cluster_setslot now validate slot < 16384
- parse_vadd/parse_vsim check MAX_VECTOR_DIMS inside the loop instead
  of after full allocation, preventing unnecessary memory usage
@kacy
kacy merged commit adde6d7 into main Feb 14, 2026
4 of 7 checks passed
@kacy
kacy deleted the security/protocol-hardening branch February 14, 2026 22:47
kacy added a commit that referenced this pull request Feb 19, 2026
…tor parsing eagerly (#131)

- parse_f64 now rejects inf/-inf (was only rejecting NaN), making it
  consistent with parse_incrbyfloat which already had this check
- parse_slot_list and parse_cluster_setslot now validate slot < 16384
- parse_vadd/parse_vsim check MAX_VECTOR_DIMS inside the loop instead
  of after full allocation, preventing unnecessary memory usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant